package com.gewu.pm.ui.adapter.promotion;

import android.content.Context;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.gewu.pm.R;
import com.gewu.pm.app.AppAdapter;

/**
 * 促销商品列表适配器
 */
public final class PromotionProductAdapter extends AppAdapter<String> {

    public PromotionProductAdapter(Context context) {
        super(context);
    }

    @NonNull
    @Override
    public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        return new ItemViewHolder();
    }

    private final class ItemViewHolder extends AppAdapter<?>.ViewHolder {

        private final ImageView mProductImageView;
        private final TextView mProductTitleView;
        private final TextView mProductCountView;
        private final TextView mProductTotalView;

        private ItemViewHolder() {
            super(R.layout.promotion_product_item);
            mProductImageView = findViewById(R.id.iv_product);
            mProductTitleView = findViewById(R.id.tv_product_title);
            mProductCountView = findViewById(R.id.tv_product_count);
            mProductTotalView = findViewById(R.id.tv_product_total);
        }

        @Override
        public void onBindView(int position) {
            String productName = getItem(position);
            
            // TODO: 根据实际数据设置
            mProductImageView.setImageResource(R.drawable.logo_big_ic);
            mProductTitleView.setText("促销主品");
            mProductCountView.setText("品种数量: 3");
            mProductTotalView.setText("商品总数: 10");
        }
    }
}

